package com.zrrd.learn.chapter06;

import java.util.Arrays;

/**
 * 调用
 *
 * @author asus
 * @version 1.0
 * @date 2023/7/12 14:17
 */
public class Array {
    public static void question(int[][] arr){
        int sum1 = 0;
        for (int i = 0; i < arr.length ;i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (i == j) {
                    sum1 =sum1+ arr[i][j];
                }

            }
        }
        System.out.println("左对角线之和为：" + sum1);
    }
    public static void main(String[] args) {
//        //引用类型 Arrays数组帮助类
//        int[] as = {23,1,3,4,5,6,7};
//        //排序sort
//        Arrays.sort(as);
//        //范围提制copyOf
//       Arrays.copyOf(as,3);
//        Arrays.copyOfRange(as,2,5);
//        //填充fill，给2000个数的数组每个赋值为15
//        int[] a=new int[2000];
//        Arrays.fill(a,15);
////        二分查找(必须是有序数组)binarySearch
//        Arrays.sort(as);
//        System.out.println(Arrays.binarySearch(as, 7));

        int[][] arr ={{1,2,3},{4,5,6},{7,8,9}};
        question(arr);


    }

}
